<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>审计系统 - 上传规范性文件</title>
		<link
			rel="stylesheet"
			href="{{ url_for('static', filename='css/style.css') }}"
		/>
	</head>
	<body>
		<div class="container">
			<div class="card">
				<a href="{{ url_for('index') }}" class="btn btn-back">返回项目列表</a>
				<h2>上传规范性文件</h2>
				<div class="button-group">
					<!-- 修改查看已上传文件按钮的链接 -->
					<a
						href="{{ url_for('list_normative_documents', project_id=project_id) }}"
						class="btn"
						>查看已上传文件</a
					>
				</div>

				{% if error %}
				<div class="error">{{ error }}</div>
				{% endif %}
				<form
					action="{{ url_for('upload_normative_document', project_id=project_id) }}"
					method="post"
					enctype="multipart/form-data"
				>
					<input type="hidden" name="project_id" value="{{ project_id }}" />
					<div class="form-group">
						<label for="name">文件名称</label>
						<input
							type="text"
							id="name"
							name="name"
							required
							autocomplete="off"
						/>
					</div>
					<div class="form-group">
						<label for="description">文件描述</label>
						<textarea id="description" name="description"></textarea>
					</div>
					<div class="form-group">
						<label for="category">文件分类</label>
						<input type="text" id="category" name="category" />
					</div>
					<div class="form-group">
						<label for="version">文件版本</label>
						<input type="text" id="version" name="version" />
					</div>
					<div class="form-group">
						<label for="file">选择文件</label>
						<input
							type="file"
							id="file"
							name="file"
							required
							onchange="document.getElementById('name').value = this.files[0].name.split('.').slice(0, -1).join('.')"
						/>
					</div>
					<button type="submit" class="btn">上传文件</button>
				</form>
			</div>
		</div>
	</body>
</html>
